]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
status/powerProfiles: Set profile name as subtitle
authorGeorges Basile Stavracas Neto <georges.stavracas@gmail.com>
Tue, 31 Jan 2023 17:38:39 +0000 (14:38 -0300)
committerGeorges Basile Stavracas Neto <georges.stavracas@gmail.com>
Sat, 4 Feb 2023 17:50:36 +0000 (14:50 -0300)
Just like with network names, set the name of the power profile as
the subtitle of the quick settings pill. This allows more of the
power profile name to be visible, and reduces chances of ellipsing
the name.

Rename the 'title' variable to 'name', to be more semantic and
better represent what it is now.

Related: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/5770
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2619>

js/ui/status/powerProfiles.js

index eed24557124e8e04de8834b92862efa9d2a6ac50..1a394bca24a75bdb45fd2d6569495a5a67e304e6 100644 (file)
@@ -17,17 +17,17 @@ const PowerProfilesProxy = Gio.DBusProxy.makeProxyWrapper(PowerProfilesIface);
 
 const PROFILE_PARAMS = {
     'performance': {
-        title: C_('Power profile', 'Performance'),
+        name: C_('Power profile', 'Performance'),
         iconName: 'power-profile-performance-symbolic',
     },
 
     'balanced': {
-        title: C_('Power profile', 'Balanced'),
+        name: C_('Power profile', 'Balanced'),
         iconName: 'power-profile-balanced-symbolic',
     },
 
     'power-saver': {
-        title: C_('Power profile', 'Power Saver'),
+        name: C_('Power profile', 'Power Saver'),
         iconName: 'power-profile-power-saver-symbolic',
     },
 };
@@ -37,7 +37,7 @@ const LAST_PROFILE_KEY = 'last-selected-power-profile';
 const PowerProfilesToggle = GObject.registerClass(
 class PowerProfilesToggle extends QuickMenuToggle {
     _init() {
-        super._init();
+        super._init({title: _('Power Mode')});
 
         this._profileItems = new Map();
 
@@ -83,11 +83,11 @@ class PowerProfilesToggle extends QuickMenuToggle {
             .map(p => p.Profile.unpack())
             .reverse();
         for (const profile of profiles) {
-            const {title, iconName} = PROFILE_PARAMS[profile];
-            if (!title)
+            const {name, iconName} = PROFILE_PARAMS[profile];
+            if (!name)
                 continue;
 
-            const item = new PopupMenu.PopupImageMenuItem(title, iconName);
+            const item = new PopupMenu.PopupImageMenuItem(name, iconName);
             item.connect('activate',
                 () => (this._proxy.ActiveProfile = profile));
             this._profileItems.set(profile, item);
@@ -111,7 +111,9 @@ class PowerProfilesToggle extends QuickMenuToggle {
                 : PopupMenu.Ornament.NONE);
         }
 
-        this.set(PROFILE_PARAMS[activeProfile]);
+        const {name: subtitle, iconName} = PROFILE_PARAMS[activeProfile];
+        this.set({subtitle, iconName});
+
         this.checked = activeProfile !== 'balanced';
 
         if (this.checked)